package com.findyou.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * @Title: WebMvcJavaConfig
 * @Author 贾金博
 * @Package com.findyou.config
 * @description: 控制层的配置类 (controller springmvc)
 */

//@EnableWebMvc自动 创建handlerMapping handlerAdapter
@EnableWebMvc // json转换器 开启springMvc
@Configuration // 配置类
@ComponentScan({"com.findyou.controller", "com.findyou.exceptionhandler"})
public class WebMvcJavaConfig implements WebMvcConfigurer { // WebMvcConfigurer 帮我们简化配置springmvc相关的

    //静态资源处理
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }


    //jsp视图解析器 前后缀
    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.jsp("/WEB-INF/views", "jsp");
    }


    // 拦截器的配置
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

    }
}
